package com.controller;

import com.entity.Student;
import com.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Arrays;
import java.util.Map;
@Controller
public class StudentController {
    @Autowired
    private StudentService studentService;
    @RequestMapping("/selectAll")
    @ResponseBody
    public Map selectAll(Integer page, Integer limit, String studentName){
        return studentService.selectAll(page,limit,studentName);
    }
    @RequestMapping("/selectOne")
    @ResponseBody
    public Student selectOneById(Integer studentId){
        return studentService.selectOneById(studentId);
    }

    @RequestMapping("/update")
    @ResponseBody
    public Map update(Student student){
        return studentService.update(student);
    }

    @RequestMapping("/multiDelete")
    @ResponseBody
    public Map multiDelete(int[] ids){
        //String[] ids =request.getParamterValues("ids[]");
        //System.out.println(Arrays.toString(ids)+"*********");
        return studentService.multiDelete(ids);
    }
}
